﻿package org.yawnage.interfaces.framework 
{
	import org.yawnage.framework.server.Publisher;

	/**
	  * <p>//TODO:To be written</p>
	  * @author Berry Jordaan
	  * @date 2011/09/06 08:57 AM
	  * @copyright Copyright © Berry/James 2011
	  * @version 1.0.0.0
	  * @description
	  * @history Berry Jordaan on 2011/09/06 08:57 AM: Created
	  */
	public interface IBroker
	{
		/**
		 * 
		 * @param	publisher
		 */
		function register(publisher:Publisher):void;

		/**
		 * 
		 */
		function unRegisterAll():void;

		/**
		 * 
		 * @param	publisherNameP
		 */
		function unRegisterByName(publisherNameP:String):void;

		/**
		 * 
		 */
		function printPublishers():void;
		
		/**
		 * 
		 * @param	publisherNameP
		 */
		function printServices(publisherNameP:String):void;

		/**
		 * 
		 * @param	publisherP
		 * @param	serviceP
		 */
		function addServicesToPublisher(publisherP:Publisher, serviceP:IServiceLayer):void;

		/**
		 * 
		 */
		function printAll():void;

		/**
		 * 
		 */
		function printAllPublisherObjects():void;
		
		/**
		 * 
		 * @param	publisherNameP
		 * @return
		 */
		function publisherID(publisherNameP:String):int;

		/**
		 * 
		 * @param	publisherNameP
		 * @return
		 */
		function publisherByName(publisherNameP:String):IPublisher;

		/**
		 * 
		 * @param	publisherNameP
		 * @return
		 */
		function isPublisher(publisherNameP:String):Boolean;

		/**
		 * 
		 * @return
		 */
		function integrityCheck():Boolean;

		/**
		 * 
		 * @param	subscriberP
		 * @param	callBackP
		 * @param	publisherNameP
		 * @param	serviceNameP
		 * @param	priority
		 */
		function subscribe(subscriberP:ISubscriber, callBackP:Function, publisherNameP:String, serviceNameP:String, priority:int = 0):void;

		/**
		 * 
		 * @param	subscriberP
		 * @param	callBackP
		 * @param	publisherNameP
		 * @param	serviceNameP
		 */
		function unSubscribe(subscriberP:ISubscriber, callBackP:Function, publisherNameP:String, serviceNameP:String):void;

		/**
		 * 
		 * @param	publisherNameP
		 */
		function unSubscribeAllFromPublisher(publisherNameP:String):void;

		/**
		 * 
		 * @param	publisherNameP
		 * @param	serviceNameP
		 */
		function unSubscribeAllFromService(publisherNameP:String, serviceNameP:String):void;

		/**
		 * 
		 */
		function unSubscribeAll():void;

		/**
		 * 
		 * @param	publisherP
		 * @param	serviceNameP
		 * @param	transportLayerP
		 */
		function syndicate(publisherP:Publisher, serviceNameP:String, transportLayerP:ITransportLayer = null):void;

		/**
		 * 
		 */
		function ready():void;
		
	}
	
}